const ora = require('ora')

const spinner = ora('Loading unicorns')

function xSpinner(options) {

    spinner.color = 'yellow'
    spinner.text = 'Waiting...... '
    spinner.spinner = { frames: ['⌛️', '⏳'], interval: 250 }

    if (typeof options == 'object' && !Array.isArray(options)) {
        for (const key in options) {
            if (Object.hasOwnProperty.call(options, key)) {
                const element = options[key];
                spinner[key] = element
            }
        }
    }

    return spinner
}

module.exports = xSpinner